<template>
  <div>
    <el-container>
      <el-header>&nbsp;人力资源管理系统</el-header>
      <el-container class="container">
        <el-aside width="300px">
          <Menu></Menu>
        </el-aside>
        <el-container>
          <el-main>
            <el-row>
              <el-col :span="24">
                <div class="grid-content bg-purple-dark">
                  <span>
                    薪酬标准查询
                  </span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  <span>
                    标准编号
                  </span>
                </div>
              </el-col>
              <el-col :span="6">
                <div class="grid-content bg-purple-light">
                  <span>
                    标准名称
                  </span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  <span>
                    制定人
                  </span>
                </div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple-light">
                  <span>
                    职位分类
                  </span>
                </div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple">
                  <span>
                    职位名称
                  </span>
                </div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple-light">
                  <span>
                    职称
                  </span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  <span>
                    薪酬总额
                  </span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  <span>
                    详情
                  </span>
                </div>
              </el-col>
            </el-row>
            <el-row v-for="(item, index) in salaryStandFileList" :key="index">
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  {{ item.salaryId }}
                </div>
              </el-col>
              <el-col :span="6">
                <div class="grid-content bg-purple-light">
                  {{ item.salaryName }}
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  {{ item.maker }}
                </div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple-light">
                  {{ item.cjobId }}
                </div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple">
                  {{ item.njobId }}
                </div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple-light">
                  {{ item.tjobId }}
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  {{ item.totalFormatted }}
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  <el-button type="primary" round @click="detail(item.salaryId)">详情</el-button>
                </div>
              </el-col>
            </el-row>
          </el-main>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { defineComponent, ref } from 'vue';
import { Document, Location, Menu as IconMenu, Setting } from '@element-plus/icons-vue';
import Menu from "@/components/Menu";

export default defineComponent({
  name: "SalaryStandardQueryList",
  components: {
    Menu,
    Location,
    Document,
    Setting,
    IconMenu,
  },

  data() {
    return {
      salaryStandQueryFile: {
        salaryId: null,
        message: null,
        timeValueStart: null,
        timeValueEnd: null,
      },
      salaryStandFileList: [], // 修改这里，使用数组存储列表数据
    };
  },

  methods: {
    detail(id) {
      this.$router.push("/SalaryStandardQueryList/" + id);
    },
    formatData() {
      this.salaryStandFileList.forEach(item => {
        item.totalFormatted = parseFloat(item.total).toFixed(2);
      });
    },
  },
  created() {
    // 检查参数是否为空，如果为空则赋值为'empty'
    this.salaryStandQueryFile.salaryId = this.$route.query.salaryId || 'empty';
    this.salaryStandQueryFile.message = this.$route.query.message || 'empty';
    this.salaryStandQueryFile.timeValueStart = this.$route.query.timeValueStart || 'undefined';
    this.salaryStandQueryFile.timeValueEnd = this.$route.query.timeValueEnd || 'undefined';

    const _this = this;
    // 使用修改后的参数值构造URL
    _this.axios.get("/salary/queryFile/" +
        encodeURIComponent(this.salaryStandQueryFile.salaryId) + "/" +
        encodeURIComponent(this.salaryStandQueryFile.message) + "/" +
        encodeURIComponent(this.salaryStandQueryFile.timeValueStart) + "/" +
        encodeURIComponent(this.salaryStandQueryFile.timeValueEnd)
    ).then(res => {
      _this.salaryStandFileList = res.data.data;
      _this.formatData(); // 获取数据后格式化
    });
  },
});
</script>

<style scoped>
.el-header{
  background-color: #409EFF;
  color: #e9eef3;
  text-align: left;
  line-height: 60px;
  font-size: 30px;
}
.el-aside {
  background-color: #d3dce6;
  color: var(--el-text-color-primary);
  text-align: center;
  /*line-height: 860px;*/
}

.el-main {
  background-color: #e9eef3;
  color: var(--el-text-color-primary);
  text-align: center;
  line-height: 30px;
}

body > .el-container {
  margin-bottom: 400px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.el-row {
  margin-bottom: 20px;
}

.el-row :last-child {
  margin-bottom: 0;
}

.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #d3dce6;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}

.high-row{
  min-height: 200px;
}

.container{
  min-height: 860px;
}

.line {
  width: 70%;
}

.line div {
  width: 100%;
  height: 0;
  border-top: 1px solid var(--el-border-color-base);
}

</style>




<!--
<template>
  <div>
    <el-container>
      <el-header>&nbsp;人力资源管理系统</el-header>
      <el-container class="container">
        <el-aside width="300px">
          <Menu>

          </Menu>
        </el-aside>
        <el-container>
          <el-main>
            <el-row>
              <el-col :span="24">
                <div class="grid-content bg-purple-dark">
                  <span>
                    薪酬标准查询
                  </span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  <span>
                    标准编号
                  </span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  <span>
                    标准名称
                  </span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  <span>
                    制定人
                  </span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  <span>
                    职位分类
                  </span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  <span>
                    职位名称
                  </span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  <span>
                    职称
                  </span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  <span>
                    薪酬总额
                  </span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  <span>
                    详情
                  </span>
                </div>
              </el-col>
            </el-row>
            <el-row
                :model="salaryStandFile"
                placement="top"
                v-for="salaryStandFile in salaryStandFile">
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  {{salaryStandFile.salaryId}}
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  {{salaryStandFile.salaryName}}
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  {{salaryStandFile.maker}}
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  {{salaryStandFile.cjobId}}
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  {{salaryStandFile.njobId}}
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  {{salaryStandFile.tjobId}}
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">
                  {{salaryStandFile.total}}
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  <el-button type="primary" round @click="detail(salaryStandFile.salaryId)">详情</el-button>
                </div>
              </el-col>
            </el-row>
          </el-main>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import {defineComponent, ref} from 'vue'
import {Document, Location, Menu as IconMenu, Setting,} from '@element-plus/icons-vue'
import Menu from "@/components/Menu";

export default defineComponent({
  name: "SalaryStandardQueryList",
  components: {
    Menu,
    Location,
    Document,
    Setting,
    IconMenu,
  },

  data() {
    return {
      salaryStandQueryFile: {
        salaryId: null,
        message: null,
        timeValueStart: null,
        timeValueEnd: null,
      },

      salaryStandFile: {
        salaryId: '',
        salaryName: '',
        maker: '',
        cjobId: '',
        njobId: '',
        tjobId: '',
        total: '',
      }
    }
  },

  methods: {
    detail(id) {
      this.$router.push("/SalaryStandardChange/" + id)
    }
  },
  created() {
    this.salaryStandQueryFile.salaryId = this.$route.query.salaryId
    this.salaryStandQueryFile.message = this.$route.query.message
    this.salaryStandQueryFile.timeValueStart = this.$route.query.timeValueStart
    this.salaryStandQueryFile.timeValueEnd = this.$route.query.timeValueEnd
    const _this = this
    _this.axios.get("/salary/queryFile/" + this.salaryStandQueryFile.salaryId + "/" + this.salaryStandQueryFile.message + "/" + this.salaryStandQueryFile.timeValueStart + "/" + this.salaryStandQueryFile.timeValueEnd).then(res => {
      _this.salaryStandFile = res.data.data
    })
  },
  setup() {
    const activeNames = ref(['1'])
    const handleChange = (val) => {
      console.log(val)
    }

    return {
      activeNames,
      handleChange,
    }
  }
})
</script>

<style scoped>
.el-header{
  background-color: #409EFF;
  color: #e9eef3;
  text-align: left;
  line-height: 60px;
  font-size: 30px;
}
.el-aside {
  background-color: #d3dce6;
  color: var(&#45;&#45;el-text-color-primary);
  text-align: center;
  /*line-height: 860px;*/
}

.el-main {
  background-color: #e9eef3;
  color: var(&#45;&#45;el-text-color-primary);
  text-align: center;
  line-height: 30px;
}

body > .el-container {
  margin-bottom: 400px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.el-row {
  margin-bottom: 20px;
}

.el-row :last-child {
  margin-bottom: 0;
}

.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #d3dce6;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}

.high-row{
  min-height: 200px;
}

.container{
  min-height: 860px;
}

.line {
  width: 70%;
}

.line div {
  width: 100%;
  height: 0;
  border-top: 1px solid var(&#45;&#45;el-border-color-base);
}

</style>
-->
